float4x4 World;
float4x4 View;
float4x4 Projection;

texture Texture;
sampler Sampler = sampler_state
{
    Texture = (Texture);  
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
    
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 Texcoord : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    
    float4 pos = input.Position;
    float index = pos.w;
    pos.x -= 0.5f;
    pos.z *=3.0f;
    pos.y = 2.0f;
    pos.w = 1.0f;

    float4 worldPosition = mul(pos, World);
    worldPosition.y = 3.0f;
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    output.Texcoord = input.Position.xz;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    //return tex2D(Sampler, input.Texcoord);
    return float4(input.Texcoord,0,1);
}

technique Tech
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}
